* Statistics for Table A.7
* Final goods import share and intermediate input import share for Argentina from INDEC data.

* Final goods
clear
import excel "../Database/INDEC/consumo8_93-07.xls" // load data
drop in 1/8
drop in 16/17
keep A C D
ren A year
ren C Cimp
ren D Ctotal
destring year, replace
destring Cimp, replace
destring Ctotal, replace
gen importshareC = Cimp / Ctotal * 100
keep if year>=2000 & year<=2004
drop Cimp Ctotal
export excel year importshareC using "../../../Output/TableA7_Arg", first(var) sh("Consumption") replace

* Intermediate goods

clear
import excel "../Database/INDEC/imp_uso_econ_80_20.xls" // note: data on imports of intermediates is in thousands of US dollars.
keep A D E F G H
ren A v
ren D y2000
ren E y2001
ren F y2002
ren G y2003
ren H y2004
drop in 1/33
drop in 2/41
replace v="M" if v=="Bienes intermedios"
destring y2000, replace
destring y2001, replace
destring y2002, replace
reshape long y, i(v) j(year)
drop v
rename y IntermediatesImports
sort year
save "temp/IntermediatesImports_temp.dta", replace

* Prepare nominal GDP in US dollars from IFS
use "../Database/output/Database.dta", clear
gen GDP_USD = GDP / E4
keep if year>=2000 & year<=2004
keep if ccode=="ARG"
keep GDP_USD year
sort year
merge year using "temp/IntermediatesImports_temp.dta"
drop _merge
gen importshare = IntermediatesImports*1000/GDP_USD * 100
export excel year importshare using "../../../Output/TableA7_Arg", first(var) sh("Intermediates")
